/**
 * date: 2018年2月21日
 * 使用'Visual Studio Code 1.18.1'编写(from Mac)
 * 
 * https://www.tslang.cn/docs/handbook/classes.html
 * 
 */

class Greeter {
    greeting: string;
    constructor(message: string){
        this.greeting = message;
    }
    greet() {
        return "Hello, " + this.greeting;
    }
}

let greeter = new Greeter("world");

/**
 * 继承
 */

class Animal {
    move(distanceInMeters: number = 0) {
        console.log(`Animal moved ${distanceInMeters}m.`);
    }
}

class Dog extends Animal {
    bark() {
        console.log('Woof! Woof!');
    }
}

const dog = new Dog();
dog.bark();
dog.move(10);
dog.bark();
